export default {
	Toast: function(title) {
		uni.showToast({
			title: title,
			duration: 2000,
			icon: 'none'
		});
	},

	path: function(url, status) {
		if (status) {
			uni.reLaunch({
				url: url
			});
		} else {
			uni.navigateTo({
				url: url,
				animationType: 'pop-in',
				animationDuration: 0
			});
		}

	},
	formatTimeWithDate: function(timeArray) {
		// 检查输入数组是否有效
		if (!Array.isArray(timeArray) || timeArray.length !== 2) {
			throw new Error('Invalid input: timeArray must be an array with two elements.');
		}

		// 获取当前日期
		let now = new Date();

		// 格式化日期，确保月份和日期是两位数
		let year = now.getFullYear();
		let month = (now.getMonth() + 1).toString().padStart(2, '0'); // 月份从0开始，所以加1
		let day = now.getDate().toString().padStart(2, '0');

		// 从数组中获取小时和分钟，并格式化为两位数
		let hours = timeArray[0].toString().padStart(2, '0');
		let minutes = timeArray[1].toString().padStart(2, '0');

		// 构建最终的时间字符串，秒统一为"00"
		let formattedTime = `${year}-${month}-${day} ${hours}:${minutes}:00`;

		return formattedTime;
	}

}